<?php

require "include/bittorrent.php";
dbconn();
loggedinorreturn();
$HTMLOUT = "";
if ($CURUSER['class'] < UC_USER)
	stderr("错误", "您的等级太低", false);
$id = isset($_GET['id']) && is_valid_id($_GET['id']) ? $_GET['id'] : 0;
$res = sql_query("SELECT * FROM betoptions WHERE id =" . sqlesc($id) . "") or sqlerr(__FILE__, __LINE__);
$a = mysql_fetch_assoc($res);
$sp = (int) $a['gameid'];
$res2 = sql_query("SELECT * FROM betgames WHERE id =" . sqlesc($sp) . "") or sqlerr(__FILE__, __LINE__);
$b = mysql_fetch_assoc($res2);
if ($b['active'] == 0) {
	header("location: bet.php");
	exit;
}
$HTMLOUT .="<a href='bet.php'><img src='betting.png' alt='Bet' title='博彩' width='400' height='125' /></a>
<h1>博彩频道</h1>
<table class='main' cellspacing='0' cellpadding='5' border='0'>
<tr>
<td align='center' class='navigation'><a href='bet.php'>当前竞猜</a></td>
<td align='center' class='navigation'><a href='bet_old.php'>闭盘竞猜</a></td>
<td align='center' class='navigation'><a href='bet_coupon.php'>我的押注</a></td>
<td align='center' class='navigation'><a href='bet_bonustop.php'>用户排名</font></a></td>
<td align='center' class='navigation'><a href='bet_info.php'>系统帮助</a></td>
</tr>
</table>
<form method='post' action='bet_odds2.php'>
<table cellpadding='5'>
<tr>
<td class='colhead' width='100'>标题</td>
<td class='colhead' width='100'>选项</td>
<td class='colhead'>倍率</td>
<td class='colhead'>押注金额</td>
<td class='colhead'>确认按钮</td>
</tr>
<tr>
<td>{$b['heading']}</td>
<td>{$a['text']}</td>
<td>{$a['odds']}</td>
<td>
<input type='text' name='bonus' onkeyup=\"this.value = this.value.replace(/\D/g, '');\" />  <b> 魔力值</b>
<input type='hidden' name='id' value='" . htmlspecialchars($id) . "' /></td>
<td><input type='submit' value='下注' /></td></tr></table></form>";
if (isset($_GET['err'])) {
	if ($_GET['err'] == "b")
		$HTMLOUT .="<font color='#ff0000'>魔力值不足</font>";
	elseif ($_GET['err'] == "c")
		$HTMLOUT .="<font color='#ff0000'>下注数出错</font>";
	elseif ($_GET['err'] == "d")
		$HTMLOUT .="<font color='#ff0000'>最高下注金额1W</font>.";
}
stdhead('博彩');
print $HTMLOUT;
stdfoot();
